using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using CPlatePrintSys.Domain.Models;

namespace CPlatePrintSys.Win.ViewModels
{
    /// <summary>
    /// 测试数据生成器
    /// </summary>
    public static class TestDataGenerator
    {
        /// <summary>
        /// 生成用于布局功能测试的PlateAnnotationInfo数据
        /// </summary>
        public static List<PlateAnnotationInfo> GenerateLayoutTestData()
        {
            var testData = new List<PlateAnnotationInfo>();

            // 镜像布局测试数据 - 原始对象
            testData.Add(new PlateAnnotationInfo
            {
                Id = 1,
                MotherShipNo = "M001",
                StreamShipNo = "S001",
                LotNo = "L001",
                PlateNo = "P001",
                Sequence = "SEQ001",
                CNO = "CNO001",
                DesignSpecCls = "A",
                DesignSpecThickness = 10.0,
                DesignSpecLength = 2000.0,
                DesignSpecWidth = 1000.0,
                SheetConsistentNo = "B13B8PN103", // 原始对象编号
                SheetSpecCls = "A",
                SheetSpecThickness = 10.0,
                SheetSpecLength = 20000.0,
                SheetSpecWidth = 4000.0,
                LayoutMean = LayoutMean.Unprocessed,
                MergedInfo = "",
                LayoutInfo = null,
                PlanUsedDate = DateTime.Now.AddDays(30),
                IsAnnotationGenerated = false,
                DesignDrawingPath = @"C:\TestData\B13B8PN103.dxf",
                SourceType = SourceType.AM
            });

            // 镜像布局测试数据 - 镜像对象
            testData.Add(new PlateAnnotationInfo
            {
                Id = 2,
                MotherShipNo = "M001",
                StreamShipNo = "S001",
                LotNo = "L001",
                PlateNo = "P002",
                Sequence = "SEQ002",
                CNO = "CNO002",
                DesignSpecCls = "A",
                DesignSpecThickness = 10.0,
                DesignSpecLength = 2000.0,
                DesignSpecWidth = 1000.0,
                SheetConsistentNo = "B13B8PM103", // 镜像对象编号
                SheetSpecCls = "A",
                SheetSpecThickness = 10.0,
                SheetSpecLength = 20000.0,
                SheetSpecWidth = 4000.0,
                LayoutMean = LayoutMean.Unprocessed,
                MergedInfo = "",
                LayoutInfo = null,
                PlanUsedDate = DateTime.Now.AddDays(30),
                IsAnnotationGenerated = false,
                DesignDrawingPath = @"C:\TestData\B13B8PM103.dxf",
                SourceType = SourceType.AM
            });

            // 合并布局测试数据 - 零件1
            testData.Add(new PlateAnnotationInfo
            {
                Id = 3,
                MotherShipNo = "M002",
                StreamShipNo = "S002",
                LotNo = "L002",
                PlateNo = "P003",
                Sequence = "SEQ003",
                CNO = "CNO003",
                DesignSpecCls = "B",
                DesignSpecThickness = 12.0,
                DesignSpecLength = 1500.0,
                DesignSpecWidth = 800.0,
                SheetConsistentNo = "A05A7PA002",
                SheetSpecCls = "B",
                SheetSpecThickness = 12.0,
                SheetSpecLength = 20000.0,
                SheetSpecWidth = 4000.0,
                LayoutMean = LayoutMean.Unprocessed,
                MergedInfo = "",
                LayoutInfo = null,
                PlanUsedDate = DateTime.Now.AddDays(45),
                IsAnnotationGenerated = false,
                DesignDrawingPath = @"C:\TestData\A05A7PA002.dxf",
                SourceType = SourceType.AM
            });

            // 合并布局测试数据 - 零件2
            testData.Add(new PlateAnnotationInfo
            {
                Id = 4,
                MotherShipNo = "M002",
                StreamShipNo = "S002",
                LotNo = "L002",
                PlateNo = "P004",
                Sequence = "SEQ004",
                CNO = "CNO004",
                DesignSpecCls = "B",
                DesignSpecThickness = 12.0,
                DesignSpecLength = 1200.0,
                DesignSpecWidth = 600.0,
                SheetConsistentNo = "A05A7PA003",
                SheetSpecCls = "B",
                SheetSpecThickness = 12.0,
                SheetSpecLength = 20000.0,
                SheetSpecWidth = 4000.0,
                LayoutMean = LayoutMean.Unprocessed,
                MergedInfo = "",
                LayoutInfo = null,
                PlanUsedDate = DateTime.Now.AddDays(45),
                IsAnnotationGenerated = false,
                DesignDrawingPath = @"C:\TestData\A05A7PA003.dxf",
                SourceType = SourceType.AM
            });

            // 合并布局测试数据 - 零件3
            testData.Add(new PlateAnnotationInfo
            {
                Id = 5,
                MotherShipNo = "M002",
                StreamShipNo = "S002",
                LotNo = "L002",
                PlateNo = "P005",
                Sequence = "SEQ005",
                CNO = "CNO005",
                DesignSpecCls = "B",
                DesignSpecThickness = 12.0,
                DesignSpecLength = 1800.0,
                DesignSpecWidth = 900.0,
                SheetConsistentNo = "A05A7PA004",
                SheetSpecCls = "B",
                SheetSpecThickness = 12.0,
                SheetSpecLength = 20000.0,
                SheetSpecWidth = 4000.0,
                LayoutMean = LayoutMean.Unprocessed,
                MergedInfo = "",
                LayoutInfo = null,
                PlanUsedDate = DateTime.Now.AddDays(45),
                IsAnnotationGenerated = false,
                DesignDrawingPath = @"C:\TestData\A05A7PA004.dxf",
                SourceType = SourceType.AM
            });

            // 已处理的镜像布局数据
            testData.Add(new PlateAnnotationInfo
            {
                Id = 6,
                MotherShipNo = "M003",
                StreamShipNo = "S003",
                LotNo = "L003",
                PlateNo = "P006",
                Sequence = "SEQ006",
                CNO = "CNO006",
                DesignSpecCls = "C",
                DesignSpecThickness = 15.0,
                DesignSpecLength = 2500.0,
                DesignSpecWidth = 1200.0,
                SheetConsistentNo = "C08C9PN201",
                SheetSpecCls = "C",
                SheetSpecThickness = 15.0,
                SheetSpecLength = 2500.0,
                SheetSpecWidth = 1200.0,
                LayoutMean = LayoutMean.MirrorLayout,
                MergedInfo = "C08C9PN201/C08C9PM201",
                LayoutInfo = @"{
                    ""LayoutMean"": ""1"",
                    ""Mirrored"": {
                        ""OriginalObjNo"": ""C08C9PN201"",
                        ""MirrorObjNo"": ""C08C9PM201""
                    }
                }",
                PlanUsedDate = DateTime.Now.AddDays(60),
                IsAnnotationGenerated = true,
                DesignDrawingPath = @"C:\TestData\C08C9PN201.dxf",
                SourceType = SourceType.CadWin
            });

            // 已处理的合并布局数据
            testData.Add(new PlateAnnotationInfo
            {
                Id = 7,
                MotherShipNo = "M004",
                StreamShipNo = "S004",
                LotNo = "L004",
                PlateNo = "P007",
                Sequence = "SEQ007",
                CNO = "CNO007",
                DesignSpecCls = "D",
                DesignSpecThickness = 8.0,
                DesignSpecLength = 3000.0,
                DesignSpecWidth = 1500.0,
                SheetConsistentNo = "D12D5PA301",
                SheetSpecCls = "D",
                SheetSpecThickness = 8.0,
                SheetSpecLength = 3000.0,
                SheetSpecWidth = 1500.0,
                LayoutMean = LayoutMean.MergedLayout,
                MergedInfo = "D12D5PA301/D12D5PA302/D12D5PA303",
                LayoutInfo = @"{
                    ""LayoutMean"": ""2"",
                    ""Merged"": {
                        ""SheetLongth"": 3000,
                        ""SheetWidth"": 1500,
                        ""PartLayouts"": [
                            {
                                ""SheetConsistentNo"": ""D12D5PA301"",
                                ""Position"": {
                                    ""X"": 0,
                                    ""Y"": 0
                                }
                            },
                            {
                                ""SheetConsistentNo"": ""D12D5PA302"",
                                ""Position"": {
                                    ""X"": 1000,
                                    ""Y"": 0
                                }
                            },
                            {
                                ""SheetConsistentNo"": ""D12D5PA303"",
                                ""Position"": {
                                    ""X"": 2000,
                                    ""Y"": 0
                                }
                            }
                        ]
                    }
                }",
                PlanUsedDate = DateTime.Now.AddDays(75),
                IsAnnotationGenerated = true,
                DesignDrawingPath = @"C:\TestData\D12D5PA301.dxf",
                SourceType = SourceType.AM
            });

            // ========== 新增一对多测试数据 ==========

            // S005 船号对应多个LOT号测试数据
            // S005 -> L005A, L005B, L005C

            // S005 -> L005A -> SEQ008
            testData.Add(new PlateAnnotationInfo
            {
                Id = 8,
                MotherShipNo = "M005",
                StreamShipNo = "S005",
                LotNo = "L005A",
                PlateNo = "P008",
                Sequence = "SEQ008",
                CNO = "CNO008",
                DesignSpecCls = "E",
                DesignSpecThickness = 16.0,
                DesignSpecLength = 2200.0,
                DesignSpecWidth = 1100.0,
                SheetConsistentNo = "E15E6PA401",
                SheetSpecCls = "E",
                SheetSpecThickness = 16.0,
                SheetSpecLength = 22000.0,
                SheetSpecWidth = 4000.0,
                LayoutMean = LayoutMean.Unprocessed,
                MergedInfo = "",
                LayoutInfo = null,
                PlanUsedDate = DateTime.Now.AddDays(90),
                IsAnnotationGenerated = false,
                DesignDrawingPath = @"C:\TestData\E15E6PA401.dxf",
                SourceType = SourceType.AM
            });

            // S005 -> L005B -> SEQ009
            testData.Add(new PlateAnnotationInfo
            {
                Id = 9,
                MotherShipNo = "M005",
                StreamShipNo = "S005",
                LotNo = "L005B",
                PlateNo = "P009",
                Sequence = "SEQ009",
                CNO = "CNO009",
                DesignSpecCls = "E",
                DesignSpecThickness = 16.0,
                DesignSpecLength = 1800.0,
                DesignSpecWidth = 900.0,
                SheetConsistentNo = "E15E6PA402",
                SheetSpecCls = "E",
                SheetSpecThickness = 16.0,
                SheetSpecLength = 22000.0,
                SheetSpecWidth = 4000.0,
                LayoutMean = LayoutMean.Unprocessed,
                MergedInfo = "",
                LayoutInfo = null,
                PlanUsedDate = DateTime.Now.AddDays(90),
                IsAnnotationGenerated = false,
                DesignDrawingPath = @"C:\TestData\E15E6PA402.dxf",
                SourceType = SourceType.AM
            });

            // S005 -> L005C -> SEQ010
            testData.Add(new PlateAnnotationInfo
            {
                Id = 10,
                MotherShipNo = "M005",
                StreamShipNo = "S005",
                LotNo = "L005C",
                PlateNo = "P010",
                Sequence = "SEQ010",
                CNO = "CNO010",
                DesignSpecCls = "E",
                DesignSpecThickness = 16.0,
                DesignSpecLength = 1600.0,
                DesignSpecWidth = 800.0,
                SheetConsistentNo = "E15E6PA403",
                SheetSpecCls = "E",
                SheetSpecThickness = 16.0,
                SheetSpecLength = 22000.0,
                SheetSpecWidth = 4000.0,
                LayoutMean = LayoutMean.Unprocessed,
                MergedInfo = "",
                LayoutInfo = null,
                PlanUsedDate = DateTime.Now.AddDays(90),
                IsAnnotationGenerated = false,
                DesignDrawingPath = @"C:\TestData\E15E6PA403.dxf",
                SourceType = SourceType.AM
            });

            // S006 船号对应多个LOT号，且LOT号对应多个加工序列测试数据
            // S006 -> L006A -> SEQ011, SEQ012
            // S006 -> L006B -> SEQ013, SEQ014, SEQ015

            // S006 -> L006A -> SEQ011
            testData.Add(new PlateAnnotationInfo
            {
                Id = 11,
                MotherShipNo = "M006",
                StreamShipNo = "S006",
                LotNo = "L006A",
                PlateNo = "P011",
                Sequence = "SEQ011",
                CNO = "CNO011",
                DesignSpecCls = "F",
                DesignSpecThickness = 20.0,
                DesignSpecLength = 2800.0,
                DesignSpecWidth = 1400.0,
                SheetConsistentNo = "F18F7PA501",
                SheetSpecCls = "F",
                SheetSpecThickness = 20.0,
                SheetSpecLength = 28000.0,
                SheetSpecWidth = 4000.0,
                LayoutMean = LayoutMean.Unprocessed,
                MergedInfo = "",
                LayoutInfo = null,
                PlanUsedDate = DateTime.Now.AddDays(105),
                IsAnnotationGenerated = false,
                DesignDrawingPath = @"C:\TestData\F18F7PA501.dxf",
                SourceType = SourceType.AM
            });

            // S006 -> L006A -> SEQ012
            testData.Add(new PlateAnnotationInfo
            {
                Id = 12,
                MotherShipNo = "M006",
                StreamShipNo = "S006",
                LotNo = "L006A",
                PlateNo = "P012",
                Sequence = "SEQ012",
                CNO = "CNO012",
                DesignSpecCls = "F",
                DesignSpecThickness = 20.0,
                DesignSpecLength = 2400.0,
                DesignSpecWidth = 1200.0,
                SheetConsistentNo = "F18F7PA502",
                SheetSpecCls = "F",
                SheetSpecThickness = 20.0,
                SheetSpecLength = 28000.0,
                SheetSpecWidth = 4000.0,
                LayoutMean = LayoutMean.Unprocessed,
                MergedInfo = "",
                LayoutInfo = null,
                PlanUsedDate = DateTime.Now.AddDays(105),
                IsAnnotationGenerated = false,
                DesignDrawingPath = @"C:\TestData\F18F7PA502.dxf",
                SourceType = SourceType.AM
            });

            // S006 -> L006B -> SEQ013
            testData.Add(new PlateAnnotationInfo
            {
                Id = 13,
                MotherShipNo = "M006",
                StreamShipNo = "S006",
                LotNo = "L006B",
                PlateNo = "P013",
                Sequence = "SEQ013",
                CNO = "CNO013",
                DesignSpecCls = "F",
                DesignSpecThickness = 20.0,
                DesignSpecLength = 2000.0,
                DesignSpecWidth = 1000.0,
                SheetConsistentNo = "F18F7PA503",
                SheetSpecCls = "F",
                SheetSpecThickness = 20.0,
                SheetSpecLength = 28000.0,
                SheetSpecWidth = 4000.0,
                LayoutMean = LayoutMean.Unprocessed,
                MergedInfo = "",
                LayoutInfo = null,
                PlanUsedDate = DateTime.Now.AddDays(105),
                IsAnnotationGenerated = false,
                DesignDrawingPath = @"C:\TestData\F18F7PA503.dxf",
                SourceType = SourceType.AM
            });

            // S006 -> L006B -> SEQ014
            testData.Add(new PlateAnnotationInfo
            {
                Id = 14,
                MotherShipNo = "M006",
                StreamShipNo = "S006",
                LotNo = "L006B",
                PlateNo = "P014",
                Sequence = "SEQ014",
                CNO = "CNO014",
                DesignSpecCls = "F",
                DesignSpecThickness = 20.0,
                DesignSpecLength = 1800.0,
                DesignSpecWidth = 900.0,
                SheetConsistentNo = "F18F7PA504",
                SheetSpecCls = "F",
                SheetSpecThickness = 20.0,
                SheetSpecLength = 28000.0,
                SheetSpecWidth = 4000.0,
                LayoutMean = LayoutMean.Unprocessed,
                MergedInfo = "",
                LayoutInfo = null,
                PlanUsedDate = DateTime.Now.AddDays(105),
                IsAnnotationGenerated = false,
                DesignDrawingPath = @"C:\TestData\F18F7PA504.dxf",
                SourceType = SourceType.AM
            });

            // S006 -> L006B -> SEQ015
            testData.Add(new PlateAnnotationInfo
            {
                Id = 15,
                MotherShipNo = "M006",
                StreamShipNo = "S006",
                LotNo = "L006B",
                PlateNo = "P015",
                Sequence = "SEQ015",
                CNO = "CNO015",
                DesignSpecCls = "F",
                DesignSpecThickness = 20.0,
                DesignSpecLength = 1600.0,
                DesignSpecWidth = 800.0,
                SheetConsistentNo = "F18F7PA505",
                SheetSpecCls = "F",
                SheetSpecThickness = 20.0,
                SheetSpecLength = 28000.0,
                SheetSpecWidth = 4000.0,
                LayoutMean = LayoutMean.Unprocessed,
                MergedInfo = "",
                LayoutInfo = null,
                PlanUsedDate = DateTime.Now.AddDays(105),
                IsAnnotationGenerated = false,
                DesignDrawingPath = @"C:\TestData\F18F7PA505.dxf",
                SourceType = SourceType.AM
            });

            return testData;
        }

        /// <summary>
        /// 生成用于布局功能测试的ViewModel数据
        /// </summary>
        public static ObservableCollection<PlateAnnotationInfoViewModel> GenerateLayoutTestViewModels()
        {
            var testData = GenerateLayoutTestData();
            return PlateAnnotationInfoViewModel.CreateFromList(testData);
        }
    }
} 